#    Copyright 2011 Tri-County Electric Cooperative, St. Matthews, South Carolina
#    This file is part of COOPIP.
#    COOPIP is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#    COOPIP is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#    You should have received a copy of the GNU General Public License
#    along with COOPIP.  If not, see <http://www.gnu.org/licenses/>.

import os
import datetime
import shutil

#************************BEGIN Add Include Files to Path************************
import sys
NeededPaths=['/opt/coopip/djangoproject/include', '/opt/coopip/djangoproject']
for path in NeededPaths:
    if(not path in sys.path):
        sys.path.append(path)
#************************END   Add Include Files to Path************************
from django.contrib.gis.geos import *
import os, time, psycopg2, datetime
#********************Setup psycopg2 and django section********************
PathDjangoRoot="/opt/coopip/"
if(not PathDjangoRoot in sys.path):
    sys.path.append(PathDjangoRoot)
from django.core.management import setup_environ
import djangoproject
from djangoproject import settings
setup_environ(settings)
from models import *
#********************Setup psycopg2 and django section********************

from django.template import Context, loader
from django.http import HttpResponse
from django import forms
import os
import datetime
import djangoproject.settings
import COOPIP_Misc, COOPIP_Form
import djangoproject.models.ipbase
from djangoproject.models.ipbase import *
import cPickle


def BuildAddressPhoneForm(SpecialBuildFormDataDict):
    Dict={}
    AddressPhoneChoices=[]
    AddressPhones=AddressPhone.objects.all().order_by('AddressOne')
    for i in AddressPhones:
        AddressPhoneChoices.append([i.id, str(i)])

    Dict['SelectAddressPhone']=forms.ChoiceField(AddressPhoneChoices, required=False)
    Dict['UpdateIndicator']=forms.BooleanField(required=False)
    Dict['NewIndicator']=forms.BooleanField(required=False)
    Dict['Description']=forms.CharField(required=False, widget=forms.TextInput(attrs={'size':'15'}))
    Dict['AccountName']=forms.CharField(required=False, widget=forms.TextInput(attrs={'size':'15'}))
    Dict['AddressOne']=forms.CharField(required=False, widget=forms.TextInput(attrs={'size':'15'}))
    Dict['AddressTwo']=forms.CharField(required=False, widget=forms.TextInput(attrs={'size':'15'}))
    Dict['AddressThree']=forms.CharField(required=False, widget=forms.TextInput(attrs={'size':'15'}))
    Dict['City']=forms.CharField(required=False, widget=forms.TextInput(attrs={'size':'15'}))
    Dict['State']=forms.CharField(required=False, widget=forms.TextInput(attrs={'size':'15'}))
    Dict['Zip']=forms.CharField(required=False, widget=forms.TextInput(attrs={'size':'15'}))
    Dict['HomePhone']=forms.CharField(required=False, widget=forms.TextInput(attrs={'size':'15'}))
    Dict['CellPhone']=forms.CharField(required=False, widget=forms.TextInput(attrs={'size':'15'}))
    Dict['OtherPhone']=forms.CharField(required=False, widget=forms.TextInput(attrs={'size':'15'}))
    Dict['Fax']=forms.CharField(required=False, widget=forms.TextInput(attrs={'size':'15'}))
    Dict['Email']=forms.CharField(required=False, widget=forms.TextInput(attrs={'size':'15'}))
    
    return Dict


